/**
 * 
 */
package com.dp.behav.util.observer;

import java.util.Observable;
import java.util.Observer;

/**
 * @author Sunaina.Sharma
 * 
 */
public class CurrentConditions implements Observer {
	private float temperature;
	private float humidity;
	private Observable weatherData;

	CurrentConditions(Observable subject) {
		this.weatherData = subject;
		weatherData.addObserver(this);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
	 */
	public void update(Observable obj, Object arg) {
		if (obj instanceof WeatherDetails) {
			WeatherDetails weatherDetaiils = (WeatherDetails) obj;
			temperature = weatherDetaiils.getTemperature();
			humidity = weatherDetaiils.getHumidity();
			System.out.println("Measurements updated :: Temperature - "
					+ temperature + " Humidity - " + humidity);
		}
	}

}
